package day11.reflect2;

import java.lang.reflect.Method;
import java.util.Scanner;


public class MyJUnit {

    public static void main(String[] args) throws Exception {
        System.out.println("请输入被测试类的完整类名:"); //
        Scanner sc = new Scanner(System.in);
        String clsName = sc.nextLine();

        //类反射
        Class c = Class.forName(clsName);
        Object obj = c.newInstance();

        //注解+类反射
        Method ms[] = c.getDeclaredMethods();
        for(Method m: ms){
            if(m.isAnnotationPresent(MyTest.class)){
                System.out.println("执行:"+m.getName());
                m.invoke(obj, null);
            }
        }

    }
}